package com.activity.bean;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;

public class ClassSpan {

    /**
     * attendacetimespanname : 默认班次
     * attendacetimespan_endtime : 18:00
     * attendacetimespanid : 1
     * attendacetimespan_timelength : 9
     * attendacetimespan_storeno : 1000001
     * attendacetimespan_begintime : 09:00
     */

    private String attendacetimespanname;
    private String attendacetimespan_endtime;
    private String attendacetimespanid;
    private String attendacetimespan_timelength;
    private String attendacetimespan_storeno;
    private String attendacetimespan_begintime;

    public  boolean selected;
    public String getAttendacetimespanname() {
        return attendacetimespanname;
    }

    public void setAttendacetimespanname(String attendacetimespanname) {
        this.attendacetimespanname = attendacetimespanname;
    }

    public String getAttendacetimespan_endtime() {
        return attendacetimespan_endtime;
    }

    public void setAttendacetimespan_endtime(String attendacetimespan_endtime) {
        this.attendacetimespan_endtime = attendacetimespan_endtime;
    }

    public String getAttendacetimespanid() {
        return attendacetimespanid;
    }

    public void setAttendacetimespanid(String attendacetimespanid) {
        this.attendacetimespanid = attendacetimespanid;
    }

    public String getAttendacetimespan_timelength() {
        return attendacetimespan_timelength;
    }

    public void setAttendacetimespan_timelength(String attendacetimespan_timelength) {
        this.attendacetimespan_timelength = attendacetimespan_timelength;
    }

    public String getAttendacetimespan_storeno() {
        return attendacetimespan_storeno;
    }

    public void setAttendacetimespan_storeno(String attendacetimespan_storeno) {
        this.attendacetimespan_storeno = attendacetimespan_storeno;
    }

    public String getAttendacetimespan_begintime() {
        return attendacetimespan_begintime;
    }

    public void setAttendacetimespan_begintime(String attendacetimespan_begintime) {
        this.attendacetimespan_begintime = attendacetimespan_begintime;
    }

    public String getHours(){
        ArrayList<String> arrayList =new ArrayList(Arrays.asList(StringUtils.split(attendacetimespan_timelength,":")));

        if(arrayList.size()==2){
            if(arrayList.get(0).equals("0")){

                if(arrayList.get(1).equals("0")){

                    return "";
                }else
                {
                    return  arrayList.get(1)+"分钟";
                }
            }else {

                if(arrayList.get(1).equals("0")){

                    return arrayList.get(0)+"小时";
                }else
                {
                    return arrayList.get(0)+"小时"+ arrayList.get(1)+"分钟";
                }
            }
        }

        return "";
    }
}
